package expressions.slogo;

import parsing.Separates;
import parsing.Token;
import expressions.Expression;
import expressions.IContext;
import expressions.LeftBlock;

/**
 * Together with a RightBracket, denotes a block of commands to be executed in
 * order.
 * 
 * The return value is the return value of the last command in the block.
 */
@Token(regex = "\\[")
@Separates
public class LeftBracket extends LeftBlock<Double>
{
    @Override
    public Double evaluate(IContext<Double> context)
    {
        Double result = 0D;

        for (Expression<Double> child : children)
            result = child.evaluate(context);

        return result;
    }

}
